<?php

declare(strict_types=1);


namespace App\Constants;

class CodeData
{

    /**
     * @var 成功
     */
    const SUCCESS = 200;

    /**
     * @var 弹出弹窗提示
     */
    const POPUP_PROMPT = 201;

    /**
     * @var 静默提示
     */
    const NO_PROMPT = 202;

    /**
     * @var 跳转编辑个人中心页面
     */
    const JUMP_EDIT_PROFILE = 203;

    /**
     * @var 跳转充值页面
     */
    const JUMP_RECHARGE = 204;

    /**
     * @var 跳转完善资料页面
     */
    const JUMP_PERFECT_DATA = 205;

    /**
     * @var 弹出提示
     */
    const NEED_TIPS = 420;

    /**
     * @var 认证过期
     */
    const AUTH_EXPIRED = 421;

    /**
     * @var 参数错误
     */
    const PARAMS_ABNORMAL = 422;

    /**
     * @var 服务异常
     */
    const SERVER_ABNORMAL = 500;

    /**
     * @var 数据异常
     */
    const DATA_ABNORMAL = 501;

    /**
     * @var 数据库异常
     */
    const DATABASE_ABNORMAL = 502;

    /**
     * @var 缓存异常
     */
    const CACHE_ABNORMAL = 503;

    /**
     * @var RSA解密失败
     */
    const RSA_DECODE_ERROR = 504;


    public static function getCodeData($code): string
    {
        $data = [
            self::SUCCESS => '成功',
            self::POPUP_PROMPT => '弹出弹窗提示',
            self::NEED_TIPS => '弹出提示',
            self::NO_PROMPT => '静默提示',
            self::JUMP_EDIT_PROFILE => '跳转编辑个人中心页面',
            self::JUMP_RECHARGE => '跳转充值页面',
            self::PARAMS_ABNORMAL => '参数异常',
            self::SERVER_ABNORMAL => '服务异常',
            self::DATA_ABNORMAL => '数据异常',
            self::DATABASE_ABNORMAL => '数据库异常',
            self::CACHE_ABNORMAL => '缓存异常',
            self::AUTH_EXPIRED => '认证过期',
        ];
        return $data[$code] ?? '未知错误';
    }


}